const db = require('../db/config');
const { sqlQueryDetailDatas } = require('../db/sql');

module.exports.getDetailHandler = function (req, res) {
    const tableName = req.body.field,
        id = Number(req.body.id);

    db.query(sqlQueryDetailDatas(tableName), [id], (error, result) => {
        if (error) {
            return res.send({
                statusText: '获取详情页出错'
            });
        } else {
            console.log(typeof result[0])
            return res.send(result[0]);
        }
    });
}
